home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / util / misc / cookies.lha / Cookie / cookhash.c < prev    next >
C/C++ Source or Header  |  1995-04-27  |  31KB  |  1,278 lines

  1. /* A lexical scanner generated by flex */
  2.  
  3. /* Scanner skeleton version:
  4.  * $Header: /home/daffy/u0/vern/flex/flex-2.4.7/RCS/flex.skl,v 1.2 94/08/03 11:13:24 vern Exp $
  5.  */
  6.  
  7. #define FLEX_SCANNER
  8.  
  9. #include <stdio.h>
  10. #if defined(__SASC) && defined(_AMIGA)
  11. #include <fcntl.h>
  12. #endif
  13.  
  14.  
  15. /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
  16. #ifdef c_plusplus
  17. #ifndef __cplusplus
  18. #define __cplusplus
  19. #endif
  20. #endif
  21.  
  22.  
  23. #ifdef __cplusplus
  24.  
  25. #include <stdlib.h>
  26. #include <unistd.h>
  27.  
  28. /* Use prototypes in function declarations. */
  29. #define YY_USE_PROTOS
  30.  
  31. /* The "const" storage-class-modifier is valid. */
  32. #define YY_USE_CONST
  33.  
  34. #else    /* ! __cplusplus */
  35.  
  36. #ifdef __STDC__
  37.  
  38. #define YY_USE_PROTOS
  39. #define YY_USE_CONST
  40.  
  41. #endif    /* __STDC__ */
  42. #endif    /* ! __cplusplus */
  43.  
  44.  
  45. #ifdef __TURBOC__
  46. #define YY_USE_CONST
  47. #endif
  48.  
  49.  
  50. #ifndef YY_USE_CONST
  51. #ifndef const
  52. #define const
  53. #endif
  54. #endif
  55.  
  56.  
  57. #ifdef YY_USE_PROTOS
  58. #define YY_PROTO(proto) proto
  59. #else
  60. #define YY_PROTO(proto) ()
  61. #endif
  62.  
  63. /* Returned upon end-of-file. */
  64. #define YY_NULL 0
  65.  
  66. /* Promotes a possibly negative, possibly signed char to an unsigned
  67.  * integer for use as an array index.  If the signed char is negative,
  68.  * we want to instead treat it as an 8-bit unsigned char, hence the
  69.  * double cast.
  70.  */
  71. #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
  72.  
  73. /* Enter a start condition.  This macro really ought to take a parameter,
  74.  * but we do it the disgusting crufty way forced on us by the ()-less
  75.  * definition of BEGIN.
  76.  */
  77. #define BEGIN yy_start = 1 + 2 *
  78.  
  79. /* Translate the current start state into a value that can be later handed
  80.  * to BEGIN to return to the state.
  81.  */
  82. #define YY_START ((yy_start - 1) / 2)
  83.  
  84. /* Action number for EOF rule of a given start state. */
  85. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  86.  
  87. /* Special action meaning "start processing a new file".  Now included
  88.  * only for backward compatibility with previous versions of flex.
  89.  */
  90. #define YY_NEW_FILE yyrestart( yyin )
  91.  
  92. #define YY_END_OF_BUFFER_CHAR 0
  93.  
  94. /* Size of default input buffer. */
  95. #define YY_BUF_SIZE 16384
  96.  
  97. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  98.  
  99. extern int yyleng;
  100. extern FILE *yyin, *yyout;
  101.  
  102. #ifdef __cplusplus
  103. extern "C" {
  104. #endif
  105.     extern int yywrap YY_PROTO(( void ));
  106. #ifdef __cplusplus
  107.     }
  108. #endif
  109.  
  110. #define EOB_ACT_CONTINUE_SCAN 0
  111. #define EOB_ACT_END_OF_FILE 1
  112. #define EOB_ACT_LAST_MATCH 2
  113.  
  114. /* The funky do-while in the following #define is used to turn the definition
  115.  * int a single C statement (which needs a semi-colon terminator).  This
  116.  * avoids problems with code like:
  117.  *
  118.  *     if ( condition_holds )
  119.  *        yyless( 5 );
  120.  *    else
  121.  *        do_something_else();
  122.  *
  123.  * Prior to using the do-while the compiler would get upset at the
  124.  * "else" because it interpreted the "if" statement as being all
  125.  * done when it reached the ';' after the yyless() call.
  126.  */
  127.  
  128. /* Return all but the first 'n' matched characters back to the input stream. */
  129.  
  130. #define yyless(n) \
  131.     do \
  132.         { \
  133.         /* Undo effects of setting up yytext. */ \
  134.         *yy_cp = yy_hold_char; \
  135.         yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
  136.         YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  137.         } \
  138.     while ( 0 )
  139.  
  140. #define unput(c) yyunput( c, yytext_ptr )
  141.  
  142.  
  143. struct yy_buffer_state
  144.     {
  145.     FILE *yy_input_file;
  146.  
  147.     char *yy_ch_buf;        /* input buffer */
  148.     char *yy_buf_pos;        /* current position in input buffer */
  149.  
  150.     /* Size of input buffer in bytes, not including room for EOB
  151.      * characters.
  152.      */
  153.     int yy_buf_size;
  154.  
  155.     /* Number of characters read into yy_ch_buf, not including EOB
  156.      * characters.
  157.      */
  158.     int yy_n_chars;
  159.  
  160.     /* Whether this is an "interactive" input source; if so, and
  161.      * if we're using stdio for input, then we want to use getc()
  162.      * instead of fread(), to make sure we stop fetching input after
  163.      * each newline.
  164.      */
  165.     int yy_is_interactive;
  166.  
  167.     /* Whether to try to fill the input buffer when we reach the
  168.      * end of it.
  169.      */
  170.     int yy_fill_buffer;
  171.  
  172.     int yy_buffer_status;
  173. #define YY_BUFFER_NEW 0
  174. #define YY_BUFFER_NORMAL 1
  175.     /* When an EOF's been seen but there's still some text to process
  176.      * then we mark the buffer as YY_EOF_PENDING, to indicate that we
  177.      * shouldn't try reading from the input source any more.  We might
  178.      * still have a bunch of tokens to match, though, because of
  179.      * possible backing-up.
  180.      *
  181.      * When we actually see the EOF, we change the status to "new"
  182.      * (via yyrestart()), so that the user can continue scanning by
  183.      * just pointing yyin at a new input file.
  184.      */
  185. #define YY_BUFFER_EOF_PENDING 2
  186.     };
  187.  
  188. static YY_BUFFER_STATE yy_current_buffer = 0;
  189.  
  190. /* We provide macros for accessing buffer states in case in the
  191.  * future we want to put the buffer states in a more general
  192.  * "scanner state".
  193.  */
  194. #define YY_CURRENT_BUFFER yy_current_buffer
  195.  
  196.  
  197. /* yy_hold_char holds the character lost when yytext is formed. */
  198. static char yy_hold_char;
  199.  
  200. static int yy_n_chars;        /* number of characters read into yy_ch_buf */
  201.  
  202.  
  203. int yyleng;
  204.  
  205. /* Points to current character in buffer. */
  206. static char *yy_c_buf_p = (char *) 0;
  207. static int yy_init = 1;        /* whether we need to initialize */
  208. static int yy_start = 0;    /* start state number */
  209.  
  210. /* Flag which is used to allow yywrap()'s to do buffer switches
  211.  * instead of setting up a fresh yyin.  A bit of a hack ...
  212.  */
  213. static int yy_did_buffer_switch_on_eof;
  214.  
  215. static void yyunput YY_PROTO(( int c, char *buf_ptr ));
  216. void yyrestart YY_PROTO(( FILE *input_file ));
  217. void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
  218. void yy_load_buffer_state YY_PROTO(( void ));
  219. YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
  220. void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
  221. void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
  222.  
  223. static int yy_start_stack_ptr = 0;
  224. static int yy_start_stack_depth = 0;
  225. static int *yy_start_stack = 0;
  226. static void yy_push_state YY_PROTO(( int new_state ));
  227. static void yy_pop_state YY_PROTO(( void ));
  228. static int yy_top_state YY_PROTO(( void ));
  229.  
  230. static void *yy_flex_alloc YY_PROTO(( unsigned int ));
  231. static void *yy_flex_realloc YY_PROTO(( void *, unsigned int ));
  232. static void yy_flex_free YY_PROTO(( void * ));
  233.  
  234. #define yy_new_buffer yy_create_buffer
  235.  
  236. #define INITIAL 0
  237. typedef unsigned char YY_CHAR;
  238. typedef int yy_state_type;
  239. FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
  240. extern char *yytext;
  241. #define yytext_ptr yytext
  242.  
  243. #ifndef yytext_ptr
  244. static void yy_flex_strncpy YY_PROTO(( char *, const char *, int ));
  245. #endif
  246.  
  247. #ifdef __cplusplus
  248. static int yyinput YY_PROTO(( void ));
  249. #else
  250. static int input YY_PROTO(( void ));
  251. #endif
  252.  
  253. static yy_state_type yy_get_previous_state YY_PROTO(( void ));
  254. static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
  255. static int yy_get_next_buffer YY_PROTO(( void ));
  256. static void yy_fatal_error YY_PROTO(( const char msg[] ));
  257.  
  258. /* Done after the current pattern has been matched and before the
  259.  * corresponding action - sets up yytext.
  260.  */
  261. #define YY_DO_BEFORE_ACTION \
  262.     yytext_ptr = yy_bp; \
  263.     yyleng = yy_cp - yy_bp; \
  264.     yy_hold_char = *yy_cp; \
  265.     *yy_cp = '\0'; \
  266.     yy_c_buf_p = yy_cp;
  267.  
  268. #define YY_END_OF_BUFFER 4
  269. static const short int yy_accept[11] =
  270.     {   0,
  271.         0,    0,    4,    2,    2,    0,    0,    1,    0,    0
  272.     } ;
  273.  
  274. static const int yy_ec[256] =
  275.     {   0,
  276.         1,    1,    1,    1,    1,    1,    1,    1,    1,    2,
  277.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  278.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  279.         1,    1,    1,    1,    1,    1,    3,    1,    1,    1,
  280.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  281.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  282.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  283.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  284.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  285.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  286.  
  287.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  288.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  289.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  290.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  291.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  292.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  293.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  294.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  295.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  296.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  297.  
  298.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  299.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  300.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  301.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  302.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  303.         1,    1,    1,    1,    1
  304.     } ;
  305.  
  306. static const int yy_meta[4] =
  307.     {   0,
  308.         1,    1,    2
  309.     } ;
  310.  
  311. static const short int yy_base[14] =
  312.     {   0,
  313.         0,    0,   10,   11,    0,    7,    6,    0,    0,   11,
  314.         5,    3,    4
  315.     } ;
  316.  
  317. static const short int yy_def[14] =
  318.     {   0,
  319.        10,    1,   10,   10,   11,   12,   12,   13,   11,    0,
  320.        10,   10,   10
  321.     } ;
  322.  
  323. static const short int yy_nxt[15] =
  324.     {   0,
  325.         4,    4,    5,    7,    7,    9,    6,    8,    8,   10,
  326.         3,   10,   10,   10
  327.     } ;
  328.  
  329. static const short int yy_chk[15] =
  330.     {   0,
  331.         1,    1,    1,   12,   12,   13,   11,    7,    6,    3,
  332.        10,   10,   10,   10
  333.     } ;
  334.  
  335. static yy_state_type yy_last_accepting_state;
  336. static char *yy_last_accepting_cpos;
  337.  
  338. /* The intent behind this definition is that it'll catch
  339.  * any uses of REJECT which flex missed.
  340.  */
  341. #define REJECT reject_used_but_not_detected
  342. #define yymore() yymore_used_but_not_detected
  343. #define YY_MORE_ADJ 0
  344. char *yytext;
  345. # line 1 "cookhash.lex"
  346. /*
  347.  * cookhash 2.0
  348.  * Jörgen Grahn 1995-04-27
  349.  *
  350.  * generates file for random selection of cookies
  351.  * from a fortune cookie file
  352.  *
  353.  * cookhash <cookiefile >hashfile
  354.  *
  355.  * format of the cookie file:
  356.  *
  357.  * comment
  358.  * cookie
  359.  * comment
  360.  * cookie
  361.  * ...
  362.  * comment
  363.  * cookie
  364.  *
  365.  * where 'comment' is a bunch of rows starting with '%%'
  366.  *
  367.  *
  368.  * Compile with 'flex' and then an ANSI C compiler.
  369.  *
  370.  */
  371. int filepos = 0;
  372. static char verstring[] = "$" "VER: cookhash 2.0 (27.4.95)";
  373.  
  374. /* Macros after this point can all be overridden by user definitions in
  375.  * section 1.
  376.  */
  377.  
  378. #ifdef YY_MALLOC_DECL
  379. YY_MALLOC_DECL
  380. #else
  381. #if __STDC__
  382. #ifndef __cplusplus
  383. #include <stdlib.h>
  384. #endif
  385. #else
  386. /* Just try to get by without declaring the routines.  This will fail
  387.  * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
  388.  * or sizeof(void*) != sizeof(int).
  389.  */
  390. #endif
  391. #endif
  392.  
  393. /* Amount of stuff to slurp up with each read. */
  394. #ifndef YY_READ_BUF_SIZE
  395. #define YY_READ_BUF_SIZE 8192
  396. #endif
  397.  
  398. /* Copy whatever the last rule matched to the standard output. */
  399.  
  400. #ifndef ECHO
  401. /* This used to be an fputs(), but since the string might contain NUL's,
  402.  * we now use fwrite().
  403.  */
  404. #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
  405. #endif
  406.  
  407. /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  408.  * is returned in "result".
  409.  */
  410. #ifndef YY_INPUT
  411. #define YY_INPUT(buf,result,max_size) \
  412.     if ( yy_current_buffer->yy_is_interactive ) \
  413.         { \
  414.         int c = getc( yyin ); \
  415.         result = c == EOF ? 0 : 1; \
  416.         buf[0] = (char) c; \
  417.         } \
  418.     else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
  419.           && ferror( yyin ) ) \
  420.         YY_FATAL_ERROR( "input in flex scanner failed" );
  421. #endif
  422.  
  423. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  424.  * we don't want an extra ';' after the "return" because that will cause
  425.  * some compilers to complain about unreachable statements.
  426.  */
  427. #ifndef yyterminate
  428. #define yyterminate() return YY_NULL
  429. #endif
  430.  
  431. /* Number of entries by which start-condition stack grows. */
  432. #ifndef YY_START_STACK_INCR
  433. #define YY_START_STACK_INCR 25
  434. #endif
  435.  
  436. /* Report a fatal error. */
  437. #ifndef YY_FATAL_ERROR
  438. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
  439. #endif
  440.  
  441. /* Default declaration of generated scanner - a define so the user can
  442.  * easily add parameters.
  443.  */
  444. #ifndef YY_DECL
  445. #define YY_DECL int yylex YY_PROTO(( void ))
  446. #endif
  447.  
  448. /* Code executed at the beginning of each rule, after yytext and yyleng
  449.  * have been set up.
  450.  */
  451. #ifndef YY_USER_ACTION
  452. #define YY_USER_ACTION
  453. #endif
  454.  
  455. /* Code executed at the end of each rule. */
  456. #ifndef YY_BREAK
  457. #define YY_BREAK break;
  458. #endif
  459.  
  460. YY_DECL
  461.     {
  462.     register yy_state_type yy_current_state;
  463.     register char *yy_cp, *yy_bp;
  464.     register int yy_act;
  465.  
  466. # line 32 "cookhash.lex"
  467.  
  468.  
  469.  
  470.     if ( yy_init )
  471.         {
  472. #ifdef YY_USER_INIT
  473.         YY_USER_INIT;
  474. #endif
  475.  
  476.         if ( ! yy_start )
  477.             yy_start = 1;    /* first start state */
  478.  
  479.         if ( ! yyin )
  480.             yyin = stdin;
  481.  
  482.         if ( ! yyout )
  483.             yyout = stdout;
  484.  
  485.         if ( yy_current_buffer )
  486.             yy_init_buffer( yy_current_buffer, yyin );
  487.         else
  488.             yy_current_buffer =
  489.                 yy_create_buffer( yyin, YY_BUF_SIZE );
  490.  
  491.         yy_load_buffer_state();
  492.  
  493.         yy_init = 0;
  494.         }
  495.  
  496.     while ( 1 )        /* loops until end-of-file is reached */
  497.         {
  498.         yy_cp = yy_c_buf_p;
  499.  
  500.         /* Support of yytext. */
  501.         *yy_cp = yy_hold_char;
  502.  
  503.         /* yy_bp points to the position in yy_ch_buf of the start of
  504.          * the current run.
  505.          */
  506.         yy_bp = yy_cp;
  507.  
  508.         yy_current_state = yy_start;
  509. yy_match:
  510.         do
  511.             {
  512.             register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
  513.             if ( yy_accept[yy_current_state] )
  514.                 {
  515.                 yy_last_accepting_state = yy_current_state;
  516.                 yy_last_accepting_cpos = yy_cp;
  517.                 }
  518.             while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  519.                 {
  520.                 yy_current_state = (int) yy_def[yy_current_state];
  521.                 if ( yy_current_state >= 11 )
  522.                     yy_c = yy_meta[(unsigned int) yy_c];
  523.                 }
  524.             yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  525.             ++yy_cp;
  526.             }
  527.         while ( yy_base[yy_current_state] != 11 );
  528.  
  529. yy_find_action:
  530.         yy_act = yy_accept[yy_current_state];
  531.  
  532.         YY_DO_BEFORE_ACTION;
  533.  
  534.  
  535. do_action:    /* This label is used only to access EOF actions. */
  536.  
  537.  
  538.         switch ( yy_act )
  539.     { /* beginning of action switch */
  540.             case 0: /* must back up */
  541.             /* undo the effects of YY_DO_BEFORE_ACTION */
  542.             *yy_cp = yy_hold_char;
  543.             yy_cp = yy_last_accepting_cpos;
  544.             yy_current_state = yy_last_accepting_state;
  545.             goto yy_find_action;
  546.  
  547. case 1:
  548. YY_USER_ACTION
  549. # line 34 "cookhash.lex"
  550. {
  551.                 filepos += yyleng;
  552.                 printf("%06lx\n",filepos);
  553.             }
  554.     YY_BREAK
  555. case 2:
  556. YY_USER_ACTION
  557. # line 39 "cookhash.lex"
  558. {
  559.                 filepos += yyleng;
  560.             }
  561.     YY_BREAK
  562. case 3:
  563. YY_USER_ACTION
  564. # line 43 "cookhash.lex"
  565. ECHO;
  566.     YY_BREAK
  567. case YY_STATE_EOF(INITIAL):
  568.     yyterminate();
  569.  
  570.     case YY_END_OF_BUFFER:
  571.         {
  572.         /* Amount of text matched not including the EOB char. */
  573.         int yy_amount_of_matched_text = yy_cp - yytext_ptr - 1;
  574.  
  575.         /* Undo the effects of YY_DO_BEFORE_ACTION. */
  576.         *yy_cp = yy_hold_char;
  577.  
  578.         if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
  579.             {
  580.             /* We're scanning a new file or input source.  It's
  581.              * possible that this happened because the user
  582.              * just pointed yyin at a new source and called
  583.              * yylex().  If so, then we have to assure
  584.              * consistency between yy_current_buffer and our
  585.              * globals.  Here is the right place to do so, because
  586.              * this is the first action (other than possibly a
  587.              * back-up) that will match for the new input source.
  588.              */
  589.             yy_n_chars = yy_current_buffer->yy_n_chars;
  590.             yy_current_buffer->yy_input_file = yyin;
  591.             yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
  592.             }
  593.  
  594.         /* Note that here we test for yy_c_buf_p "<=" to the position
  595.          * of the first EOB in the buffer, since yy_c_buf_p will
  596.          * already have been incremented past the NUL character
  597.          * (since all states make transitions on EOB to the
  598.          * end-of-buffer state).  Contrast this with the test
  599.          * in input().
  600.          */
  601.         if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  602.             { /* This was really a NUL. */
  603.             yy_state_type yy_next_state;
  604.  
  605.             yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
  606.  
  607.             yy_current_state = yy_get_previous_state();
  608.  
  609.             /* Okay, we're now positioned to make the NUL
  610.              * transition.  We couldn't have
  611.              * yy_get_previous_state() go ahead and do it
  612.              * for us because it doesn't know how to deal
  613.              * with the possibility of jamming (and we don't
  614.              * want to build jamming into it because then it
  615.              * will run more slowly).
  616.              */
  617.  
  618.             yy_next_state = yy_try_NUL_trans( yy_current_state );
  619.  
  620.             yy_bp = yytext_ptr + YY_MORE_ADJ;
  621.  
  622.             if ( yy_next_state )
  623.                 {
  624.                 /* Consume the NUL. */
  625.                 yy_cp = ++yy_c_buf_p;
  626.                 yy_current_state = yy_next_state;
  627.                 goto yy_match;
  628.                 }
  629.  
  630.             else
  631.                 {
  632.                             yy_cp = yy_c_buf_p;
  633.                 goto yy_find_action;
  634.                 }
  635.             }
  636.  
  637.         else switch ( yy_get_next_buffer() )
  638.             {
  639.             case EOB_ACT_END_OF_FILE:
  640.                 {
  641.                 yy_did_buffer_switch_on_eof = 0;
  642.  
  643.                 if ( yywrap() )
  644.                     {
  645.                     /* Note: because we've taken care in
  646.                      * yy_get_next_buffer() to have set up
  647.                      * yytext, we can now set up
  648.                      * yy_c_buf_p so that if some total
  649.                      * hoser (like flex itself) wants to
  650.                      * call the scanner after we return the
  651.                      * YY_NULL, it'll still work - another
  652.                      * YY_NULL will get returned.
  653.                      */
  654.                     yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
  655.  
  656.                     yy_act = YY_STATE_EOF(YY_START);
  657.                     goto do_action;
  658.                     }
  659.  
  660.                 else
  661.                     {
  662.                     if ( ! yy_did_buffer_switch_on_eof )
  663.                         YY_NEW_FILE;
  664.                     }
  665.                 break;
  666.                 }
  667.  
  668.             case EOB_ACT_CONTINUE_SCAN:
  669.                 yy_c_buf_p =
  670.                     yytext_ptr + yy_amount_of_matched_text;
  671.  
  672.                 yy_current_state = yy_get_previous_state();
  673.  
  674.                 yy_cp = yy_c_buf_p;
  675.                 yy_bp = yytext_ptr + YY_MORE_ADJ;
  676.                 goto yy_match;
  677.  
  678.             case EOB_ACT_LAST_MATCH:
  679.                 yy_c_buf_p =
  680.                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
  681.  
  682.                 yy_current_state = yy_get_previous_state();
  683.  
  684.                 yy_cp = yy_c_buf_p;
  685.                 yy_bp = yytext_ptr + YY_MORE_ADJ;
  686.                 goto yy_find_action;
  687.             }
  688.         break;
  689.         }
  690.  
  691.     default:
  692.         YY_FATAL_ERROR(
  693.             "fatal flex scanner internal error--no action found" );
  694.     } /* end of action switch */
  695.         } /* end of scanning one token */
  696.     } /* end of yylex */
  697.  
  698.  
  699. /* yy_get_next_buffer - try to read in a new buffer
  700.  *
  701.  * Returns a code representing an action:
  702.  *    EOB_ACT_LAST_MATCH -
  703.  *    EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  704.  *    EOB_ACT_END_OF_FILE - end of file
  705.  */
  706.  
  707. static int yy_get_next_buffer()
  708.     {
  709.     register char *dest = yy_current_buffer->yy_ch_buf;
  710.     register char *source = yytext_ptr - 1; /* copy prev. char, too */
  711.     register int number_to_move, i;
  712.     int ret_val;
  713.  
  714.     if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
  715.         YY_FATAL_ERROR(
  716.         "fatal flex scanner internal error--end of buffer missed" );
  717.  
  718.     if ( yy_current_buffer->yy_fill_buffer == 0 )
  719.         { /* Don't try to fill the buffer, so this is an EOF. */
  720.         if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
  721.             {
  722.             /* We matched a singled characater, the EOB, so
  723.              * treat this as a final EOF.
  724.              */
  725.             return EOB_ACT_END_OF_FILE;
  726.             }
  727.  
  728.         else
  729.             {
  730.             /* We matched some text prior to the EOB, first
  731.              * process it.
  732.              */
  733.             return EOB_ACT_LAST_MATCH;
  734.             }
  735.         }
  736.  
  737.     /* Try to read more data. */
  738.  
  739.     /* First move last chars to start of buffer. */
  740.     number_to_move = yy_c_buf_p - yytext_ptr;
  741.  
  742.     for ( i = 0; i < number_to_move; ++i )
  743.         *(dest++) = *(source++);
  744.  
  745.     if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
  746.         /* don't do the read, it's not guaranteed to return an EOF,
  747.          * just force an EOF
  748.          */
  749.         yy_n_chars = 0;
  750.  
  751.     else
  752.         {
  753.         int num_to_read =
  754.             yy_current_buffer->yy_buf_size - number_to_move - 1;
  755.  
  756.         while ( num_to_read <= 0 )
  757.             { /* Not enough room in the buffer - grow it. */
  758. #ifdef YY_USES_REJECT
  759.             YY_FATAL_ERROR(
  760. "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
  761. #else
  762.  
  763.             /* just a shorter name for the current buffer */
  764.             YY_BUFFER_STATE b = yy_current_buffer;
  765.  
  766.             int yy_c_buf_p_offset = yy_c_buf_p - b->yy_ch_buf;
  767.  
  768.             b->yy_buf_size *= 2;
  769.             b->yy_ch_buf = (char *)
  770.                 yy_flex_realloc( (void *) b->yy_ch_buf,
  771.                          b->yy_buf_size );
  772.  
  773.             if ( ! b->yy_ch_buf )
  774.                 YY_FATAL_ERROR(
  775.                 "fatal error - scanner input buffer overflow" );
  776.  
  777.             yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
  778.  
  779.             num_to_read = yy_current_buffer->yy_buf_size -
  780.                         number_to_move - 1;
  781. #endif
  782.             }
  783.  
  784.         if ( num_to_read > YY_READ_BUF_SIZE )
  785.             num_to_read = YY_READ_BUF_SIZE;
  786.  
  787.         /* Read in more data. */
  788.         YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
  789.             yy_n_chars, num_to_read );
  790.         }
  791.  
  792.     if ( yy_n_chars == 0 )
  793.         {
  794.         if ( number_to_move - YY_MORE_ADJ == 1 )
  795.             {
  796.             ret_val = EOB_ACT_END_OF_FILE;
  797.             yyrestart( yyin );
  798.             }
  799.  
  800.         else
  801.             {
  802.             ret_val = EOB_ACT_LAST_MATCH;
  803.             yy_current_buffer->yy_buffer_status =
  804.                 YY_BUFFER_EOF_PENDING;
  805.             }
  806.         }
  807.  
  808.     else
  809.         ret_val = EOB_ACT_CONTINUE_SCAN;
  810.  
  811.     yy_n_chars += number_to_move;
  812.     yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  813.     yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  814.  
  815.     /* yytext begins at the second character in yy_ch_buf; the first
  816.      * character is the one which preceded it before reading in the latest
  817.      * buffer; it needs to be kept around in case it's a newline, so
  818.      * yy_get_previous_state() will have with '^' rules active.
  819.      */
  820.  
  821.     yytext_ptr = &yy_current_buffer->yy_ch_buf[1];
  822.  
  823.     return ret_val;
  824.     }
  825.  
  826.  
  827. /* yy_get_previous_state - get the state just before the EOB char was reached */
  828.  
  829. static yy_state_type yy_get_previous_state()
  830.     {
  831.     register yy_state_type yy_current_state;
  832.     register char *yy_cp;
  833.  
  834.     yy_current_state = yy_start;
  835.  
  836.     for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
  837.         {
  838.         register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
  839.         if ( yy_accept[yy_current_state] )
  840.             {
  841.             yy_last_accepting_state = yy_current_state;
  842.             yy_last_accepting_cpos = yy_cp;
  843.             }
  844.         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  845.             {
  846.             yy_current_state = (int) yy_def[yy_current_state];
  847.             if ( yy_current_state >= 11 )
  848.                 yy_c = yy_meta[(unsigned int) yy_c];
  849.             }
  850.         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  851.         }
  852.  
  853.     return yy_current_state;
  854.     }
  855.  
  856.  
  857. /* yy_try_NUL_trans - try to make a transition on the NUL character
  858.  *
  859.  * synopsis
  860.  *    next_state = yy_try_NUL_trans( current_state );
  861.  */
  862.  
  863. #ifdef YY_USE_PROTOS
  864. static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
  865. #else
  866. static yy_state_type yy_try_NUL_trans( yy_current_state )
  867. yy_state_type yy_current_state;
  868. #endif
  869.     {
  870.     register int yy_is_jam;
  871.     register char *yy_cp = yy_c_buf_p;
  872.  
  873.     register YY_CHAR yy_c = 1;
  874.     if ( yy_accept[yy_current_state] )
  875.         {
  876.         yy_last_accepting_state = yy_current_state;
  877.         yy_last_accepting_cpos = yy_cp;
  878.         }
  879.     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  880.         {
  881.         yy_current_state = (int) yy_def[yy_current_state];
  882.         if ( yy_current_state >= 11 )
  883.             yy_c = yy_meta[(unsigned int) yy_c];
  884.         }
  885.     yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  886.     yy_is_jam = (yy_current_state == 10);
  887.  
  888.     return yy_is_jam ? 0 : yy_current_state;
  889.     }
  890.  
  891.  
  892. #ifdef YY_USE_PROTOS
  893. static void yyunput( int c, register char *yy_bp )
  894. #else
  895. static void yyunput( c, yy_bp )
  896. int c;
  897. register char *yy_bp;
  898. #endif
  899.     {
  900.     register char *yy_cp = yy_c_buf_p;
  901.  
  902.     /* undo effects of setting up yytext */
  903.     *yy_cp = yy_hold_char;
  904.  
  905.     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  906.         { /* need to shift things up to make room */
  907.         /* +2 for EOB chars. */
  908.         register int number_to_move = yy_n_chars + 2;
  909.         register char *dest = &yy_current_buffer->yy_ch_buf[
  910.                     yy_current_buffer->yy_buf_size + 2];
  911.         register char *source =
  912.                 &yy_current_buffer->yy_ch_buf[number_to_move];
  913.  
  914.         while ( source > yy_current_buffer->yy_ch_buf )
  915.             *--dest = *--source;
  916.  
  917.         yy_cp += dest - source;
  918.         yy_bp += dest - source;
  919.         yy_n_chars = yy_current_buffer->yy_buf_size;
  920.  
  921.         if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  922.             YY_FATAL_ERROR( "flex scanner push-back overflow" );
  923.         }
  924.  
  925.     if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
  926.         yy_cp[-2] = '\n';
  927.  
  928.     *--yy_cp = (char) c;
  929.  
  930.  
  931.     /* Note: the formal parameter *must* be called "yy_bp" for this
  932.      * macro to now work correctly.
  933.      */
  934.     YY_DO_BEFORE_ACTION; /* set up yytext again */
  935.     }
  936.  
  937.  
  938. #ifdef __cplusplus
  939. static int yyinput()
  940. #else
  941. static int input()
  942. #endif
  943.     {
  944.     int c;
  945.  
  946.     *yy_c_buf_p = yy_hold_char;
  947.  
  948.     if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  949.         {
  950.         /* yy_c_buf_p now points to the character we want to return.
  951.          * If this occurs *before* the EOB characters, then it's a
  952.          * valid NUL; if not, then we've hit the end of the buffer.
  953.          */
  954.         if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  955.             /* This was really a NUL. */
  956.             *yy_c_buf_p = '\0';
  957.  
  958.         else
  959.             { /* need more input */
  960.             yytext_ptr = yy_c_buf_p;
  961.             ++yy_c_buf_p;
  962.  
  963.             switch ( yy_get_next_buffer() )
  964.                 {
  965.                 case EOB_ACT_END_OF_FILE:
  966.                     {
  967.                     if ( yywrap() )
  968.                         {
  969.                         yy_c_buf_p =
  970.                         yytext_ptr + YY_MORE_ADJ;
  971.                         return EOF;
  972.                         }
  973.  
  974.                     YY_NEW_FILE;
  975. #ifdef __cplusplus
  976.                     return yyinput();
  977. #else
  978.                     return input();
  979. #endif
  980.                     }
  981.  
  982.                 case EOB_ACT_CONTINUE_SCAN:
  983.                     yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
  984.                     break;
  985.  
  986.                 case EOB_ACT_LAST_MATCH:
  987. #ifdef __cplusplus
  988.                     YY_FATAL_ERROR(
  989.                     "unexpected last match in yyinput()" );
  990. #else
  991.                     YY_FATAL_ERROR(
  992.                     "unexpected last match in input()" );
  993. #endif
  994.                 }
  995.             }
  996.         }
  997.  
  998.     c = *(unsigned char *) yy_c_buf_p;    /* cast for 8-bit char's */
  999.     *yy_c_buf_p = '\0';    /* preserve yytext */
  1000.     yy_hold_char = *++yy_c_buf_p;
  1001.  
  1002.     return c;
  1003.     }
  1004.  
  1005.  
  1006. #ifdef YY_USE_PROTOS
  1007. void yyrestart( FILE *input_file )
  1008. #else
  1009. void yyrestart( input_file )
  1010. FILE *input_file;
  1011. #endif
  1012.     {
  1013.     if ( ! yy_current_buffer )
  1014.         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
  1015.  
  1016.     yy_init_buffer( yy_current_buffer, input_file );
  1017.     yy_load_buffer_state();
  1018.     }
  1019.  
  1020.  
  1021. #ifdef YY_USE_PROTOS
  1022. void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  1023. #else
  1024. void yy_switch_to_buffer( new_buffer )
  1025. YY_BUFFER_STATE new_buffer;
  1026. #endif
  1027.     {
  1028.     if ( yy_current_buffer == new_buffer )
  1029.         return;
  1030.  
  1031.     if ( yy_current_buffer )
  1032.         {
  1033.         /* Flush out information for old buffer. */
  1034.         *yy_c_buf_p = yy_hold_char;
  1035.         yy_current_buffer->yy_buf_pos = yy_c_buf_p;
  1036.         yy_current_buffer->yy_n_chars = yy_n_chars;
  1037.         }
  1038.  
  1039.     yy_current_buffer = new_buffer;
  1040.     yy_load_buffer_state();
  1041.  
  1042.     /* We don't actually know whether we did this switch during
  1043.      * EOF (yywrap()) processing, but the only time this flag
  1044.      * is looked at is after yywrap() is called, so it's safe
  1045.      * to go ahead and always set it.
  1046.      */
  1047.     yy_did_buffer_switch_on_eof = 1;
  1048.     }
  1049.  
  1050.  
  1051. #ifdef YY_USE_PROTOS
  1052. void yy_load_buffer_state( void )
  1053. #else
  1054. void yy_load_buffer_state()
  1055. #endif
  1056.     {
  1057.     yy_n_chars = yy_current_buffer->yy_n_chars;
  1058.     yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
  1059.     yyin = yy_current_buffer->yy_input_file;
  1060.     yy_hold_char = *yy_c_buf_p;
  1061.     }
  1062.  
  1063.  
  1064. #ifdef YY_USE_PROTOS
  1065. YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
  1066. #else
  1067. YY_BUFFER_STATE yy_create_buffer( file, size )
  1068. FILE *file;
  1069. int size;
  1070. #endif
  1071.     {
  1072.     YY_BUFFER_STATE b;
  1073.  
  1074.     b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
  1075.  
  1076.     if ( ! b )
  1077.         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1078.  
  1079.     b->yy_buf_size = size;
  1080.  
  1081.     /* yy_ch_buf has to be 2 characters longer than the size given because
  1082.      * we need to put in 2 end-of-buffer characters.
  1083.      */
  1084.     b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
  1085.  
  1086.     if ( ! b->yy_ch_buf )
  1087.         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1088.  
  1089.     yy_init_buffer( b, file );
  1090.  
  1091.     return b;
  1092.     }
  1093.  
  1094.  
  1095. #ifdef YY_USE_PROTOS
  1096. void yy_delete_buffer( YY_BUFFER_STATE b )
  1097. #else
  1098. void yy_delete_buffer( b )
  1099. YY_BUFFER_STATE b;
  1100. #endif
  1101.     {
  1102.     if ( b == yy_current_buffer )
  1103.         yy_current_buffer = (YY_BUFFER_STATE) 0;
  1104.  
  1105.     yy_flex_free( (void *) b->yy_ch_buf );
  1106.     yy_flex_free( (void *) b );
  1107.     }
  1108.  
  1109.  
  1110. #ifdef YY_USE_PROTOS
  1111. void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
  1112. #else
  1113. void yy_init_buffer( b, file )
  1114. YY_BUFFER_STATE b;
  1115. FILE *file;
  1116. #endif
  1117.     {
  1118.     b->yy_input_file = file;
  1119.  
  1120.     /* We put in the '\n' and start reading from [1] so that an
  1121.      * initial match-at-newline will be true.
  1122.      */
  1123.  
  1124.     b->yy_ch_buf[0] = '\n';
  1125.     b->yy_n_chars = 1;
  1126.  
  1127.     /* We always need two end-of-buffer characters.  The first causes
  1128.      * a transition to the end-of-buffer state.  The second causes
  1129.      * a jam in that state.
  1130.      */
  1131.     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1132.     b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;
  1133.  
  1134.     b->yy_buf_pos = &b->yy_ch_buf[1];
  1135.  
  1136.     b->yy_is_interactive = file ? isatty( fileno(file) ) : 0;
  1137.  
  1138.     b->yy_fill_buffer = 1;
  1139.  
  1140.     b->yy_buffer_status = YY_BUFFER_NEW;
  1141.     }
  1142.  
  1143.  
  1144. #ifdef YY_USE_PROTOS
  1145. static void yy_push_state( int new_state )
  1146. #else
  1147. static void yy_push_state( new_state )
  1148. int new_state;
  1149. #endif
  1150.     {
  1151.     if ( yy_start_stack_ptr >= yy_start_stack_depth )
  1152.         {
  1153.         int new_size;
  1154.  
  1155.         yy_start_stack_depth += YY_START_STACK_INCR;
  1156.         new_size = yy_start_stack_depth * sizeof( int );
  1157.  
  1158.         if ( ! yy_start_stack )
  1159.             yy_start_stack = (int *) yy_flex_alloc( new_size );
  1160.  
  1161.         else
  1162.             yy_start_stack = (int *) yy_flex_realloc(
  1163.                     (void *) yy_start_stack, new_size );
  1164.  
  1165.         if ( ! yy_start_stack )
  1166.             YY_FATAL_ERROR(
  1167.             "out of memory expanding start-condition stack" );
  1168.         }
  1169.  
  1170.     yy_start_stack[yy_start_stack_ptr++] = YY_START;
  1171.  
  1172.     BEGIN(new_state);
  1173.     }
  1174.  
  1175.  
  1176. static void yy_pop_state()
  1177.     {
  1178.     if ( --yy_start_stack_ptr < 0 )
  1179.         YY_FATAL_ERROR( "start-condition stack underflow" );
  1180.  
  1181.     BEGIN(yy_start_stack[yy_start_stack_ptr]);
  1182.     }
  1183.  
  1184.  
  1185. static int yy_top_state()
  1186.     {
  1187.     return yy_start_stack[yy_start_stack_ptr - 1];
  1188.     }
  1189.  
  1190.  
  1191. #ifdef YY_USE_PROTOS
  1192. static void yy_fatal_error( const char msg[] )
  1193. #else
  1194. static void yy_fatal_error( msg )
  1195. char msg[];
  1196. #endif
  1197.     {
  1198.     (void) fprintf( stderr, "%s\n", msg );
  1199.     exit( 1 );
  1200.     }
  1201.  
  1202.  
  1203.  
  1204. /* Redefine yyless() so it works in section 3 code. */
  1205.  
  1206. #undef yyless
  1207. #define yyless(n) \
  1208.     do \
  1209.         { \
  1210.         /* Undo effects of setting up yytext. */ \
  1211.         yytext[yyleng] = yy_hold_char; \
  1212.         yy_c_buf_p = yytext + n - YY_MORE_ADJ; \
  1213.         yy_hold_char = *yy_c_buf_p; \
  1214.         *yy_c_buf_p = '\0'; \
  1215.         yyleng = n; \
  1216.         } \
  1217.     while ( 0 )
  1218.  
  1219.  
  1220. /* Internal utility routines. */
  1221.  
  1222. #ifndef yytext_ptr
  1223. #ifdef YY_USE_PROTOS
  1224. static void yy_flex_strncpy( char *s1, const char *s2, int n )
  1225. #else
  1226. static void yy_flex_strncpy( s1, s2, n )
  1227. char *s1;
  1228. const char *s2;
  1229. int n;
  1230. #endif
  1231.     {
  1232.     register int i;
  1233.     for ( i = 0; i < n; ++i )
  1234.         s1[i] = s2[i];
  1235.     }
  1236. #endif
  1237.  
  1238.  
  1239. #ifdef YY_USE_PROTOS
  1240. static void *yy_flex_alloc( unsigned int size )
  1241. #else
  1242. static void *yy_flex_alloc( size )
  1243. unsigned int size;
  1244. #endif
  1245.     {
  1246.     return (void *) malloc( size );
  1247.     }
  1248.  
  1249. #ifdef YY_USE_PROTOS
  1250. static void *yy_flex_realloc( void *ptr, unsigned int size )
  1251. #else
  1252. static void *yy_flex_realloc( ptr, size )
  1253. void *ptr;
  1254. unsigned int size;
  1255. #endif
  1256.     {
  1257.     return (void *) realloc( ptr, size );
  1258.     }
  1259.  
  1260. #ifdef YY_USE_PROTOS
  1261. static void yy_flex_free( void *ptr )
  1262. #else
  1263. static void yy_flex_free( ptr )
  1264. void *ptr;
  1265. #endif
  1266.     {
  1267.     free( ptr );
  1268.     }
  1269. # line 43 "cookhash.lex"
  1270.  
  1271.  
  1272. main()
  1273. {
  1274.     yylex();
  1275.  
  1276.     exit(0);
  1277. }
  1278.